import type { IGetCodeData, IGetCodeParams, LoginCodeData, LoginCodeParams, LoginDataType, LoginParams, UserData } from "@/types/user"
import request from "@/utils/request"

//登入接口
export const loginByPasswordApi = (data: LoginParams) => {
  return request.post<null, LoginDataType>('/login/password', data)
}

//获取验证码接口
export const getCaptchaApi = (params: IGetCodeParams) => {
  return request.get<null, IGetCodeData>('/code', { params })
}

/**
 * 用户登录接口（短信验证码方式）
 */
export const loginByMobileApi = (data: LoginCodeParams) => {
  return request.post<null, LoginCodeData>('/login', data)
}
/**
 * 用户信息接口
 */
export const getUserInfoApi = () => {
  return request.get<null, UserData>('/patient/myUser')
}